<?php
/*foreach($data['address'] as $data2)
  $data2->consignee
$data2->address
$data2->mobile
*/
?>
<!doctype html>
<html lang="zh-CH">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<!-- <meta name="viewport" content="width=device-width, initial-scale=1"> -->
	<title>木投网--个人中心--订单详情</title>
	<link rel="stylesheet" href="/resource/css/mt_index.css">
	<link rel="stylesheet" href="/resource/css/mt_user_order_details.css">
	<link rel="stylesheet" href="/resource/css/mt_showBo.css">
</head>
<body>
<!-- 顶部 -->
@include('common.shop_head')
<!-- 订单详情 -->
<div class="order-details main">
	<div class="title">当前位置：
		<a href="javascript:;">首页</a>&gt;
		<a href="/user_account">我的木投网</a>&gt;
		<a href="/user_order?status=0">我的订单</a>&gt;
		<a href="javascript:;">订单详情</a>
	</div>
	<!-- 京东 -->
	<!-- 订单已取消 -->

	@if($data['order_status'] == 6)
	 <div class="table">
		<table>
			<tbody>
				<tr class="tr-th">
					<td colspan="3">
						<span class="time">下单时间：<i>{{$data['order_time']}}</i></span>
						<span class="number">
							订单编号：
							<a href="javascript:;">{{$data['order_sn']}}</a>
						</span>
					</td>
				</tr>
				<tr class="status">
					<td colspan="3">
						<span>订单状态：<i>已取消</i></span>
					</td>
				</tr>
				<tr class="title">
					<td>商品信息</td>
					<td>仓储地</td>
					<td>付款信息</td>
				</tr>
				<tr>
					@foreach($data['product'] as $data1)
					<td class="shop-in">
						<a href="javascript:;" target="blank">
							<img src="{{$data1->product_img}}" alt="">
						</a>
						<a href="javascript:;" target="blank">{{$data1->product_name}}</a>
					</td>

						<td width="420px;">
							<dl>
								<dt>仓 &#160;储 &#160;地：</dt>
								<dd>{{$data1->storage}}</dd>
							</dl>
							<dl>
								<dt>联系电话：</dt>
								<dd>{{$data1->phone}}</dd>
							</dl>
						</td>
						@endforeach

					<td>  
						<dl> 
							<dt>付款方式：</dt>
							<dd>京东在线支付</dd>
						</dl>
						<dl>
							<dt>商品总额：</dt>
							<dd>￥{{$data['start_amount']}}</dd>
						</dl>
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<div class="bot">
							<div class="left">尊敬的顾客您好，您的订单已成功取消，欢迎再次光临木投网。</div>
							<div class="right">应付总额：<span>￥{{$data['start_amount']}}</span></div>
						</div>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
	<!-- 订单已完成 -->

	@elseif($data['order_status'] == 5)
	 <div class="table">
		<table>
			<tbody>
				<tr class="tr-th">
					<td colspan="3">
						<span class="time">下单时间：<i>{{$data['order_time']}}</i></span>
						<span class="number">
							订单编号：
							<a href="javascript:;">{{$data['order_sn']}}</a>
						</span>
					</td>
				</tr>
				<tr class="status">
					<td colspan="3">
						<span>订单状态：<i>已完成</i></span>
					</td>
				</tr>
				<tr class="title">
					<td>商品信息</td>
					<td>仓储地</td>
					<td>付款信息</td>
				</tr>
				<tr>
					@foreach($data['product'] as $data1)
						<td class="shop-in">
							<a href="javascript:;" target="blank">
								<img src="{{$data1->product_img}}" alt="">
							</a>
							<a href="javascript:;" target="blank">{{$data1->product_name}}</a>
						</td>

						<td width="420px;">
							<dl>
								<dt>仓 &#160;储 &#160;地：</dt>
								<dd>{{$data1->storage}}</dd>
							</dl>
							<dl>
								<dt>联系电话：</dt>
								<dd>{{$data1->phone}}</dd>
							</dl>
						</td>
					@endforeach
					<td>  
						<dl> 
							<dt>付款方式：</dt>
							<dd>京东在线支付</dd>
						</dl>
						<dl>
							<dt>商品总额：</dt>
							<dd>￥{{$data['start_amount']}}</dd>
						</dl>
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<div class="bot">
							<div class="right">应付总额：<span>￥{{$data['amount']}}</span></div>
						</div>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
	<!-- 订单等待支付 -->
	@elseif($data['order_status'] ==1)
	<div class="table">
		<table>
			<tbody>
			<tr class="tr-th">
				<td colspan="3">
					<span class="time" uptime="{{$data['order_time']}}"rel="{{$data['order_id']}}">下单时间：<i>{{$data['order_time']}}</i></span>
						<span class="number">
							订单编号：
							<a href="javascript:;">{{$data['order_sn']}}</a>
						</span>
					<div class="right"><a href="javascript:;" class="remove-order" rel="{{$data['order_id']}}" >取消订单</a></div>
				</td>
			</tr>
			<tr class="status status-pay">
				<td colspan="3">
					<span class="left">订单状态：<i>等待支付</i></span>
					<a href="jd_pay_first?order_id={{$data['order_id']}}" class="left">立即付款</a>
					<div class="left surplus-time">剩余支付时间：<i>22小时58分24秒</i>（逾期订单将自动取消）</div>
				</td>
			</tr>
			<tr class="title">
				<td>商品信息</td>
                <td>提货仓库</td>
				<td>付款信息</td>
			</tr>
			<tr>
				@foreach($data['product'] as $data1)
					<td class="shop-in">
						<a href="javascript:;" target="blank">
							<img src="{{$data1->product_img}}" alt="">
						</a>
						<a href="javascript:;" target="blank">{{$data1->product_name}}</a>
					</td>

					<td width="420px;">
						<dl>
							<dt>仓 &#160;储 &#160;地：</dt>
							<dd>{{$data1->storage}}</dd>
						</dl>
						<dl>
							<dt>联系电话：</dt>
							<dd>{{$data1->phone}}</dd>
						</dl>
					</td>
				@endforeach
				<td>

					<dl>
						<dt>付款方式：</dt>
						<dd>京东在线支付</dd>
					</dl>
					<dl>
						<dt>商品总额：</dt>
						<dd>￥{{$data['start_amount']}}</dd>
					</dl>
				</td>
			</tr>
			<tr>
				<td colspan="3">
					<div class="bot">
						<div class="left">该订单会为您保留24小时（从下单之日算起），24小时之后如果还未付款，系统将自动取消该订单。</div>
						<div class="right">应付总额：<span>￥{{$data['amount']}}</span></div>
					</div>
				</td>
			</tr>
			</tbody>
		</table>
	</div>

	<!-- 订单已支付 -->

	@elseif($data['order_status'] ==2 || $data['order_status'] ==4)
	 <div class="table">
		<table>
			<tbody>
				<tr class="tr-th">
					<td colspan="3">
						<span class="time">下单时间：<i>{{$data['order_time']}}</i></span>
						<span class="number">
							订单编号：
							<a href="javascript:;">{{$data['order_sn']}}</a>
						</span>
					</td>
				</tr>
				<tr class="status status-end">
					<td colspan="3">
						<span class="left">订单状态：<i>已支付</i></span>
						<a href="javascript:;" class="left btn-confirm"  rel="{{$data['order_id']}}">确认收货</a>
					</td>
				</tr>
				<tr class="title">
					<td>商品信息</td>
					<td>仓储地</td>
					<td>付款信息</td>
				</tr>
				<tr>
					@foreach($data['product'] as $data1)
						<td class="shop-in">
							<a href="javascript:;" target="blank">
								<img src="{{$data1->product_img}}" alt="">
							</a>
							<a href="javascript:;" target="blank">{{$data1->product_name}}</a>
						</td>

						<td width="420px;">
							<dl>
								<dt>仓 &#160;储 &#160;地：</dt>
								<dd>{{$data1->storage}}</dd>
							</dl>
							<dl>
								<dt>联系电话：</dt>
								<dd>{{$data1->phone}}</dd>
							</dl>
						</td>
					@endforeach

					<td>
						<dl>
							<dt>付款方式：</dt>
							<dd>京东在线支付</dd>
						</dl>
						<dl>
							<dt>商品总额：</dt>
							<dd>￥{{$data['start_amount']}}</dd>
						</dl>
					</td>
				<tr>
					<td colspan="3">
						<div class="bot">
							<div class="right">应付总额：<span>￥{{$data['amount']}}</span></div>
						</div>
					</td>
				</tr>
			</tbody>
		</table>
	</div>

	 @endif

	<!-- pos -->
	<!-- 订单等待支付 -->
	<!-- <div class="table">
		<table>
			<tbody>
				<tr class="tr-th">
					<td colspan="3">
						<span class="time" uptime="2016-7-1 00:00">下单时间：<i>2016-06-16</i></span>
						<span class="number">
							订单编号：
							<a href="javascript:;">4654321234</a>
						</span>
						<div class="right"><a href="javascript:;">取消订单</a></div>
					</td>
				</tr>
				<tr class="status status-pay">
					<td colspan="3">
						<span class="left">订单状态：<i>等待支付</i></span>
						<div class="left surplus-time">剩余支付时间：<i>22小时58分24秒</i>（逾期订单将自动取消）</div>
					</td>
				</tr>
				<tr class="title">
					<td>商品信息</td>
					<td>配送信息</td>
					<td>付款信息</td>
				</tr>
				<tr>
					<td class="shop-in">
						<a href="javascript:;" target="blank">
							<img src="img/floor_shop_2.jpg" alt="">
						</a>
						<a href="javascript:;" target="blank">樟木：重量适中，结构细，有香气，干燥时不易变形、胶合性较好</a>
					</td>
					<td width="420px;">
						<dl> 
							<dt>收 &#160;货 &#160;人：</dt>
							<dd>苏明</dd>
						</dl>
						<dl>
							<dt>地 &#160; &#160; &#160; 址：</dt>
							<dd>北京市朝阳区高碑店通惠河南路1062</dd>
						</dl>
						<dl>
							<dt>联系电话：</dt>
							<dd>18612254566</dd>
						</dl>
					</td>
					<td>  
						<dl> 
							<dt>付款方式：</dt>
							<dd>银联POS机支付</dd>
						</dl>
						<dl>
							<dt>商品总额：</dt>
							<dd>￥1562.00</dd>
						</dl>
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<div class="bot">
							<div class="left">该订单会为您保留24小时（从下单之日算起），24小时之后如果还未付款，系统将自动取消该订单。</div>
							<div class="right">应付总额：<span>￥1800.00</span></div>
						</div>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
	 -->
</div>
<!-- 底部 -->
@include('common.shop_foot')
<!-- 返回顶部 -->
<div class="pos-tooblar">
	<a href="javascript:;" class="pos-tooblar-time">
		<span class="tooblar-later"></span>
	</a>
	<a href="javascript:;" class="pos-tooblar-service">
		<span class="tooblar-later"></span>
	</a>
	<a href="javascript:;" class="pos-tooblar-tel">
		<span class="tooblar-later"></span>
	</a>
	<a href="javascript:;" class="pos-tooblar-top" id="backTop"></a>
</div>
<!-- 弹窗 -->
<div class="popup"></div>
<!-- 登录窗口 -->
<div class="popup-login">
	<div class="popup-bg">
		<div class="login-tit">
			会员登录
			<div class="login-close"></div>
		</div>
		<form action="" class="form">
			<div class="form-group">
				<label for="">手机号</label>
				<input type="text" class="form-control">
				<i class="i i-tel"></i>
			</div>
			<div class="form-group">
				<label for="">密码</label>
				<input type="password" class="form-control">
				<i class="i i-pass"></i>
				<a href="javascript:;">找回密码</a>
				<span>手机号或密码错误</span>
			</div>
			<div class="form-group form-left">
				<input type="checkbox"> 自动登录
			</div>
			<div class="form-group">
				<button type="submit" class="btn-login">登&#160&#160&#160录</button>
				<a href="javascript:;" class="a-resgin">免费注册</a>
			</div>
		</form>
	</div>
</div>

<script src="/resource/js/jquery-1.11.3.min.js"></script>
<script src="/resource/js/mt_index.js"></script>
<script src="/resource/js/mt_showBo.js"></script>  <!-- 提示信息 -->
<script>
	//导航 商品全部 隐藏显示
	var $allW = $('.all-wrap');
	$allW.hide();
	$('.nav .nav-all').attr('rel','hide');
	$('.nav .nav-all').click(function(){
		if($(this).attr('rel') == 'hide'){
			$(this).attr('rel','show');
			$allW.show();
		}else{
			$(this).attr('rel','hide');
			$allW.hide();
		};		
	});
/**
 * 订单详情 倒计时
*/
	var timeOut;
	var t,d,h,m,s,time;
	function digitTen(n){
	    if(n < 10){
	    	return "0" + n;
	    }else{
	    	return n;
	    }
	}
	//点击取消
	$('a.remove-order').click(function(){
		var order_id = $(this).attr('rel');
		Showbo.Msg.confirm('<img class="left" src="/resource/img/user_if.png" alt=""><span style="float:left;font-size:22px;color:#221815;text-align:left;line-height:34px;">确定取消订单？<br/><i class="font-size:14px;color:#898989;">订单取消后，将不能恢复，您确定取消吗？</i></span>',function(btn){
			if (btn == 'yes') {
				$.ajax({
					url : '/cancel_order_pc',
					type : "POST",
					data : {order_id:order_id},
					dataType : "json",
					cache:"false",
					timeout:30000,
					success : function(json) {
						if(json.code == 1){
							location=location
						}else{

						}
					}
				});

			}else{
				return false;
			};
		});
		$('#dvMsgBox input.btn+input.btn').css('margin-right','11px');
	});
	//确认收货
	$('a.btn-confirm').click(function(){
		var order_id = $(this).attr('rel');
		Showbo.Msg.confirm('<img class="left" src="/resource/img/user_if.png" alt=""><span style="float:left;font-size:22px;color:#221815;text-align:left;line-height:60px;">是否确认收货？</span>',function(btn){
			if (btn == 'yes') {
				$.ajax({

					url : '/confirm_receipt',
					type : "POST",
					data : {order_id:order_id},
					dataType : "json",
					cache:"false",
					timeout:30000,
					success : function(json) {
						if(json.code == 1){
							location=location
						}else{

						}
					}
				});
			}else{
				return false;
			};
		});
		$('#dvMsgBox input.btn+input.btn').css('margin-right','-100px');
	});
	function uptime(){
		var $end_time = $('.tr-th span.time').attr('uptime');
	    var end_time = $end_time.replace(/-/g,"/");
	    var EndTime = new Date(end_time); //截止时间 
	    var NowTime = new Date();
	    t = 86400000 - (NowTime.getTime() - EndTime.getTime());
	    d = Math.floor(t/1000/60/60/24);
	    h = Math.floor(t/1000/60/60%24);
	    m = Math.floor(t/1000/60%60);
	    s = Math.floor(t/1000%60);
	    time = digitTen(h) + "小时" + digitTen(m) + "分" + digitTen(s) + "秒";    
	    $('.surplus-time i').html(time);
	    timeOut = setTimeout(uptime,1000);
	    zeroTime(t);
	}
	function zeroTime(t){
		var order_id = $('span.time').attr('rel');
	    if (t < 0) {
	    	$('.surplus-time i').html("00小时00分00秒");
	    	clearTimeout(timeOut);
			$.ajax({
				url : '/cancel_order_pc',
				type : "POST",
				data : {order_id:order_id},
				dataType : "json",
				cache:"false",
				timeout:30000,
				success : function(json) {
					if(json.code == 1){
						location=location
					}else{

					}
				}
			});

	    };
	}
	uptime();
</script>
</body>
</html>